<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>7.自动填充与按比例划分栅格</title>
  <style>
    article {
      width: 300px;
      height: 300px;
      border: solid 5px silver;
      display: inline-grid;
      /*按份分*/
      /*grid-template-rows: repeat(auto-fill, 100px);
      grid-template-columns: repeat(auto-fill, 100px);*/
      /*按比例分*/
      /* 等比例 */
      grid-template-rows: repeat(3,1fr);
      grid-template-columns: repeat(3,1fr);

      /*行划分*/
      grid-template-rows: 1fr 2fr 1fr;
      grid-template-columns: 1fr 2fr 1fr;
    }

    div {
      background-color: blueviolet;
      background-clip: content-box;
      border: solid 1px blueviolet;
      padding: 10px;
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  <article>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
    <div>5</div>
    <div>6</div>
    <div>7</div>
    <div>8</div>
    <div>9</div>
  </article>
</body>

</html>